import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import { DItemError } from '@/components'
import './error.scss'

export default class DError extends Component {

    constructor(props) {
        super(props)
        this.state = {
            token: ''
        }
    }

    componentWillMount() {
        this.setState({
            token: localStorage.getItem('X-Auth0-Token')
        })
    }

    onNewClick() {
        Taro.showToast({
            icon: 'loading',
            title: '加载中',
            duration: 800
        }).then(() => {
            setTimeout(() => {
                Taro.navigateBack({
                    delta: 1
                })
            }, 1000)
        })
    }
    render() {
        const {
            token
        } = this.state
        return (
            <View className="b_error">
                {/* {
                    token && <View className='b_error__token'>{token}</View>
                } */}
                <DItemError type={4} onNewClick={this.onNewClick.bind(this)}></DItemError>
            </View>
        )
    }
}
